<template>
  <div>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" :editFormFileds="editFormFields" :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields" :searchFormFileds="searchFormFields" :searchFormOptions="searchFormOptions" :table="table" :extend="extend">
    </view-grid>
  </div>
</template>
<script>
import extend from '@/extension/mall/small_user_archives.js'
import ViewGrid from '@/components/basic/ViewGrid.vue'

var vueParam = {
  components: {
    ViewGrid,
  },
  data() {
    return {
      table: {
        key: 'memberid',
        footer: 'Foots',
        cnName: '档案信息',
        name: 'MebAccount',
        url: '/MebAccount/',
        sortName: 'create_date',
      },
      extend: extend,
      editFormFields: {
        member_phone: '',
        member_sign: '',
        member_name: '',
        member_nickname: '',
        isCabinetKeeper: '',
        isDataKeeper: '',
        member_sex: '',
        head_img: '',
        member_age: '',
        idnumber: '',
        distributorCode: '',
        idcardtype: '',
        birthday: '',
        countries: '',
        email: '',
        address: '',
        membertype: '',
        memberlevel: '',
        disabled_status: '',
        prerogative_begintime: '',
        member_describe: '',
        merchantCode: '',
        merchantName: '',
        totalpoints: '',
      },
      editFormOptions: [
        [
          {
            title: '照片',
            maxSize: 1,
            field: 'head_img',
            type: 'img',
            colSize: 4,
            maxFile: 1, 
            multiple: true,
            storage:'OSS_H',
          },
          {
            title: '签名',
            maxSize: 1,
            field: 'member_sign',
            type: 'img',
            colSize: 4,
            maxFile: 1, 
            multiple: true,
            storage:'OSS_H',
          },
          {
            title: '姓名',
            required: true,
            field: 'member_name',
            type: 'text',
            colSize: 4,
          },
          { title: '昵称', field: 'member_nickname', type: 'text', colSize: 4 },
        ],
        [
          {
            title: '性别',
            field: 'member_sex',
            type: 'drop',
            dataKey: 'gender',
            colSize: 4,
          },
          {
            title: '电话',
            field: 'member_phone',
            required: true,
            type: 'phone',
            colSize: 4,
          },
          { title: '年龄', field: 'member_age', type: 'text', colSize: 4 },
        ],
        [
          {
            title: '证件类型',
            field: 'idcardtype',
            type: 'select',
            dataKey: 'certificate_type',
            data: [],
            colSize: 4,
          },
          { title: '证件号', field: 'idnumber', type: 'text', colSize: 4 },
          { title: '会员积分', field: 'totalpoints', type: 'text', colSize: 4 },
          { title: '生日', field: 'birthday', type: 'date', colSize: 4 },
        ],
        [
          {
            title: '国家',
            field: 'countries',
            type: 'select',
            dataKey: 'Country_List',
            data: [],
            colSize: 4,
          },
          { title: '电子邮箱', field: 'email', type: 'text', colSize: 4 },
          // { "title": "分销商", "field": "distributorCode", "type": "select", dataKey: "distributorList", data: [], "required": true, }
        ],
        [
          {
            title: '详细地址',
            field: 'address',
            type: 'intSel',
            field2: 'provinCity',
            data: [],
            colSize: 8,
          },
        ],
        [
          {
            title: '会员类型',
            field: 'membertype',
            type: 'select',
            dataKey: 'Member_Type',
            data: [],
            colSize: 4,
          },
          {
            title: '会员等级',
            field: 'memberlevel',
            type: 'select',
            dataKey: '',
            data: [],
            colSize: 4,
          },
          {
            title: '是否禁用',
            field: 'disabled_status',
            type: 'switch',
            colSize: 4,
          },
        ],
        [
          {
            title: '会员有效期',
            field: 'prerogative_begintime',
            type: 'date',
            range: true,
            required:true,
            colSize: 4,
          },
          {
            title: '储物柜管理员',
            field: 'isCabinetKeeper',
            type: 'switch',
            colSize: 4,
            hidden: true,
          },
          {
            title: '数据管理员',
            field: 'isDataKeeper',
            type: 'switch',
            colSize: 4,
            hidden: true,
          },
        ],
        [
          {
            title: '禁用备注',
            field: 'member_describe',
            type: 'textarea',
            colSize: 12,
          },
        ],
      ],
      searchFormFields: {
        member_name: '',
        member_nickname: '',
        idnumber: '',
        member_phone: '',
        birthday: '',
        member_sex: '',
      },
      searchFormOptions: [
        [
          { title: '姓名', field: 'member_name', type: 'like' },
          { title: '电话', field: 'member_phone', type: 'like' },
          { title: '证件号', field: 'idnumber', type: 'like' },
        ],
        [
          {
            title: '会员类型',
            field: 'membertype',
            type: 'select',
            dataKey: 'Member_Type',
            data: [],
          },
          {
            title: '会员等级',
            field: 'memberlevel',
            type: 'select',
            dataKey: '',
            data: [],
          },
        ],
      ],
      columns: [
        {
          field: 'member_name',
          title: '姓名',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'head_img',
          title: '照片',
          type: 'img',
          width: 120,
          align: 'left',
        },
        {
          field: 'member_nickname',
          title: '昵称',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'member_sex',
          title: '性别',
          bind: { key: 'gender', data: [] },
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'member_phone',
          title: '电话',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'idcardtype',
          title: '证件类型',
          bind: { key: 'certificate_type', data: [] },
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'idnumber',
          title: '证件号',
          type: 'string',
          width: 180,
          align: 'left',
        },
        {
          field: 'totalpoints',
          title: '会员积分',
          type: 'string',
          width: 180,
          align: 'left',
        },

        {
          field: 'note',
          title: '备注',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'countries',
          title: '国家',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'address',
          title: '地址',
          type: 'string',
          width: 120,
          align: 'left',
        },
        {
          field: 'merchantName',
          title: '商户名称',
          type: 'string',
          width: 120,
          hidden: true,
          align: 'left',
        },
        {
          field: 'merchantCode',
          title: '商户编码',
          type: 'string',
          width: 120,
          hidden: true,
          align: 'left',
        },
        {
          field: 'distributorCode',
          title: '分销商',
          bind: { key: 'distributorList', data: [] },
          type: 'string',
          width: 120,
          align: 'left',
        },
      ],
      detail: {
        cnName: '会员联系人',
        columns: [],
        sortName: '',
        key: '',
      },
    }
  },
}
export default vueParam
</script>